<div class="row justify-content-center">
    <div class="col-8">
        <form (ngSubmit)="save()" [formGroup]="editForm" name="editForm" novalidate role="form">
            <h2 id="jhi-label-heading" jhiTranslate="jhipsterSampleApplicationApp.label.home.createOrEditLabel">Create
                or edit a Label</h2>

            <div>
                <jhi-alert-error></jhi-alert-error>

                <div [hidden]="!editForm.get('id')!.value" class="form-group">
                    <label for="id" jhiTranslate="global.field.id">ID</label>
                    <input class="form-control" formControlName="id" id="id" name="id" readonly type="text"/>
                </div>

                <div class="form-group">
                    <label class="form-control-label" for="field_label"
                           jhiTranslate="jhipsterSampleApplicationApp.label.label">Label</label>
                    <input class="form-control" formControlName="label" id="field_label" name="label"
                           type="text"/>
                    <div *ngIf="editForm.get('label')!.invalid && (editForm.get('label')!.dirty || editForm.get('label')!.touched)">
                        <small *ngIf="editForm.get('label')?.errors?.required"
                               class="form-text text-danger" jhiTranslate="entity.validation.required">
                            This field is required.
                        </small>
                        <small *ngIf="editForm.get('label')?.errors?.minlength"
                               [translateValues]="{ min: 3 }" class="form-text text-danger"
                               jhiTranslate="entity.validation.minlength">
                            This field is required to be at least 3 characters.
                        </small>
                    </div>
                </div>
            </div>

            <div>
                <button (click)="previousState()" class="btn btn-secondary" id="cancel-save" type="button">
                    <fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
                </button>

                <button [disabled]="editForm.invalid || isSaving" class="btn btn-primary" id="save-entity"
                        type="submit">
                    <fa-icon icon="save"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
                </button>
            </div>
        </form>
    </div>
</div>
